﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeBehind="ViewDeliveryEntry.aspx.cs" Inherits="GPSTracker.Views.Delivery.ViewDeliveryEntry" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <link href="../CSS/ViewDeliveryEntry.css" rel="stylesheet" />
    <script src="../JS/ViewDeliveryEntry.js"></script>

    <script language="javascript" type="text/javascript">

        function Fade(div) {
            setTimeout("document.getElementById('" + div + "').style.display='none'", 4000);
        }

        function showLoadingPanelDemo() {
            clientLoadingPanelDemo.Show();
        }

        function hideLoadingPanelDemo() {
            clientLoadingPanelDemo.Hide();
        }
    </script>

    <script src="../JS/jquery-1.10.2.js"></script>

    <asp:ScriptManager ID="scrptMgr" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpMain" runat="server" UpdateMode="Conditional">
        <ContentTemplate>

            <script type="text/javascript">
                $(window).ready(function () {

                    var ht = window.innerHeight - 150;
                    $('#container').css('height', ht);

                });
                $(window).resize(function () {

                    var ht = window.innerHeight - 150;
                    $('#container').css('height', ht);

                });
                var prm = Sys.WebForms.PageRequestManager.getInstance();

                prm.add_endRequest(function () {
                    var ht = window.innerHeight - 150;
                    $('#container').css('height', ht);
                });
            </script>

            <style type="text/css">
                #container {
                    position: relative;
                    min-height: 150px;
                }

                #sidebar {
                    position: absolute;
                    left: 0;
                    top: 0;
                    height: 100%;
                    width: 100%;
                    overflow-y: scroll;
                }
            </style>

            <dx:ASPxLoadingPanel ID="ASPxLoadingPanelDemo" runat="server" 
                ClientInstanceName="clientLoadingPanelDemo">
            </dx:ASPxLoadingPanel>
            <dx:ASPxCallback ID="ASPxCallbackDemo" runat="server" 
                        ClientInstanceName="clientCallbackDemo" >
                        <ClientSideEvents EndCallback="function(s, e) {
			                hideLoadingPanelDemo();
		                }" />
                    </dx:ASPxCallback>
            <div id="container">
                <div id="sidebar">

                    <table cellspacing="5" cellpadding="5" width="98%" border="0" align="center">
                        <tr>
                            <td style="width: 100%; height: 100%; text-align: center;">
                                <fieldset class="FiledSetDesign">
                                    <legend class="PageHeading" align="center">
                                        <asp:Label ID="lblHead" runat="server" Text="View Delivery Entry"></asp:Label>
                                    </legend>
                                    <table style="width: 100%; height: 100%" align="center" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td style="padding: 5px; width: 100%; text-align: center;">
                                                <table>
                                                    <tr>
                                                        <td style="padding-right: 5px;">
                                                            <dx:ASPxLabel ID="ASPxLabel2" runat="server" Text="From Date :"></dx:ASPxLabel>
                                                        </td>
                                                        <td style="padding-right: 5px;">
                                                            <dx:ASPxDateEdit ID="dtpFromDate" runat="server" Width="120" 
                                                                EditFormatString="dd-MMM-yyyy" EditFormat="DateTime"></dx:ASPxDateEdit>
                                                        </td>
                                                        <td style="padding-right: 5px;">
                                                            <dx:ASPxLabel ID="ASPxLabel1" runat="server" Text="To Date :"></dx:ASPxLabel>
                                                        </td>
                                                        <td style="padding-right: 5px;">
                                                            <dx:ASPxDateEdit ID="dtpToDate" runat="server" Width="120" 
                                                                EditFormatString="dd-MMM-yyyy" EditFormat="DateTime"></dx:ASPxDateEdit>
                                                        </td>
                                                        <td style="padding-right: 5px;">
                                                            <dx:ASPxButton ID="btnDisplay" runat="server" Text="Display Records" OnClick="btnDisplay_Click">
                                                                <ClientSideEvents Click="function(s, e)
                                                                {
                                                                    e.processOnServer = true; 
                                                                    showLoadingPanelDemo();	
							                                        clientCallbackDemo.PerformCallback('callback');
                                                                }
                                                            " />
                                                            </dx:ASPxButton>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="padding: 5px; width: 100%; height: 100%; overflow: auto;">
                                                <dx:ASPxGridView ID="grdView" runat="server" Width="100%" AutoGenerateColumns="False"
                                                    ClientInstanceName="grdView" OnCustomButtonCallback="grdView_CustomButtonCallback"
                                                    KeyFieldName="DeliveryEntryID" EnableCallBacks="False" DataSourceID="SqlDataSource1"
                                                    OnAfterPerformCallback="grdView_AfterPerformCallback">
                                                    <Columns>
                                                        <dx:GridViewCommandColumn VisibleIndex="0">
                                                            <ClearFilterButton Visible="True">
                                                            </ClearFilterButton>
                                                            <CustomButtons>
                                                                <dx:GridViewCommandColumnCustomButton ID="btnEdit" Text="Edit">
                                                                </dx:GridViewCommandColumnCustomButton>
                                                                <dx:GridViewCommandColumnCustomButton ID="btnDelete" Text="Delete">
                                                                </dx:GridViewCommandColumnCustomButton>
                                                            </CustomButtons>
                                                        </dx:GridViewCommandColumn>
                                                        <dx:GridViewDataColumn FieldName="DeliveryEntryID" VisibleIndex="1" Visible="false"></dx:GridViewDataColumn>

                                                        <dx:GridViewDataColumn FieldName="VoucherNo" Caption="Voucher No." VisibleIndex="2"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="OrderNo" Caption="Order No." VisibleIndex="3"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataDateColumn FieldName="OrderDate" Caption="Order Date" VisibleIndex="4">
                                                            <PropertiesDateEdit DisplayFormatString="dd-MMM-yyyy">
                                                            </PropertiesDateEdit>
                                                        </dx:GridViewDataDateColumn>
                                                        <dx:GridViewDataColumn FieldName="BillNo" Caption="Bill No." VisibleIndex="5"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataDateColumn FieldName="BillDate" Caption="Bill Date" VisibleIndex="6">
                                                            <PropertiesDateEdit DisplayFormatString="dd-MMM-yyyy">
                                                            </PropertiesDateEdit>
                                                        </dx:GridViewDataDateColumn>
                                                        <dx:GridViewDataColumn FieldName="WhouseCode" Caption="Warehouse" VisibleIndex="7"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="BranchCode" VisibleIndex="8"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="CustName" Caption="Customer Name" VisibleIndex="9"></dx:GridViewDataColumn>                                                        
                                                        <dx:GridViewDataColumn FieldName="Address1" Caption="Address1" VisibleIndex="10"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Address2" Caption="Address2" VisibleIndex="11"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Address3" Caption="Address3" VisibleIndex="12"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Address4" Caption="Address4" VisibleIndex="13"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="City" Caption="City" VisibleIndex="14"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Pincode" Caption="Pincode" VisibleIndex="15"></dx:GridViewDataColumn>                                                        
                                                        <dx:GridViewDataColumn FieldName="AreaName" Caption="Area" VisibleIndex="16"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="ContactNo" Caption="Contact No." VisibleIndex="17"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="EmailID" Caption="Email ID" VisibleIndex="18"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="MODEL_CODE" Caption="Model Code" VisibleIndex="19"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="MODEL_TYPE" Caption="Mode lType" VisibleIndex="20"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="ITEM_DESC" Caption="Item Description" VisibleIndex="21"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="CHASIS_NO" Caption="Chasis No." VisibleIndex="22"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="Qty" Caption="Quantity" VisibleIndex="23"></dx:GridViewDataColumn>
                                                        <dx:GridViewDataColumn FieldName="CreatedByName" Caption="Created By" VisibleIndex="24"></dx:GridViewDataColumn>
                                                    </Columns>

                                                    <Settings ShowFilterRow="True" HorizontalScrollBarMode="Auto" />
                                                    <SettingsBehavior ColumnResizeMode="Control" />
                                                    <SettingsPager PageSize="20">
                                                        <PageSizeItemSettings Visible="true" Items="20, 50, 100, 200"/>
                                                    </SettingsPager>

                                                    <ClientSideEvents CustomButtonClick="function(s, e) {
                                                            if (e.buttonID == 'btnDelete'){
                                                                e.processOnServer = confirm('Are you sure You Want To Delete???');
                                                            }
                                                            if(e.buttonID == 'btnEdit')
                                                            {
                                                                e.processOnServer = true;
                                                                showLoadingPanelDemo();	
							                                    clientCallbackDemo.PerformCallback('callback');
                                                            }
                                                        }" />
                                                </dx:ASPxGridView>
                                                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MainConn %>"></asp:SqlDataSource>
                                            </td>
                                        </tr>

                                    </table>
                                </fieldset>
                            </td>
                        </tr>
                    </table>

                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
